Contents | Index | < Browse | Browse >
XMPLFormat string for formatted inputUXMPL
An input format string consists of format commands and the input characters.
Format commands tell the input function how to convert the data read to
the variables pointed to by the arguments. All characters, which build no
format command, that is, which do not start with the "%" percent sign, and
which are no delimeters, that is, spaces, tabs and line feeds, remain untouched
and will be converted as passed to the output function.
The structure of format commands:
%[width][size]type
Arguments in angular brackets ('[' and ']') are optional.
MARKwidthUMARK
The field width as a decimal number or '*', in this case the characters
will be read but not put into the next variable in the argument queue.
MARKsizeUMARK
Specifies the size of the argument:
'h' stands for a short int or unsigned short int argument;
'l' stands for a long int or unsigned long int argument.
MARKtypeUMARK
Describes the type of the argument:
'd' stands for a signed decimal integer, the corrospending argument's type is
int *.
'i' stands for a signed decimal number, octal number (with a heading '0')
or hexadecimal number (with a heading '0x' or '0X'), the corrospending
argument's type is int *.
'o' stands for an octal number, the corrospending argument's type is int *.
'x' stands for a hexadecimal number with or without a heading '0x'/'0X', the
corrospending argument's type is int or unsigned int.
'c' will read "width" characters. Spaces and line feeds are not skipped and
no zero byte is appended. The corrospending argument's type is char *.
's' stands for a string. Heading spaces and line feeds will be skipped and
a terminating zero byte will be appended. The corrospending argument's type
is char *.
'e', 'f' and 'g' stand for a floating-point number in any notation, the
corrospending argument's type is float *.
'p' stands for a hexadecimal memory address, the corrospending argument's type
is int *.
'n' is used to save the number of characters read so far in the variable the
argument is pointing to. This format command does not read any character.
'[...]' stands for a string whose characters must be part of the string in
the angular brackets. The corrospending argument's type is char *.
'[^...]' stands for a string whose characters must not be part of the
string in the angular brackets. The corrospending argument's type is char *.
'%' stands for a percent sign to be read.
The behaviour of all other commands is undefined.